package workers;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.logging.Level;
import java.util.logging.Logger;

import model.Software;
import workerUIs.StepFrame;
import workflow.step.ImplementationStep;

public class ImplementationStepWorker extends AbstractStepSwingWorker {


	public ImplementationStepWorker(StepFrame frame, String inputQueueName,
			String outputQueueName) {
		super(frame, inputQueueName, outputQueueName);
	}

	@Override
	protected void doStep(Software software) {
		new ImplementationStep().doStep(this.software);		
	}
	
	public static void main(String[] args)
	{
		Logger logger = Logger.getLogger(ArchitectureStepWorker.class.getCanonicalName());		
		try {
			final StepFrame implementationFrame = new StepFrame("Step3a: Implementation", 800,0);
			implementationFrame.getNextButton().addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent e) {
					new ImplementationStepWorker(implementationFrame, IMQConstants.ARCH_OUTPUT_IMPL_INPUT, IMQConstants.IMPL_OUTPUT_INTEGRATION_INPUT).execute();				
				}
			});
			new QueueDepthObserver().observeQueueDepth(implementationFrame, IMQConstants.ARCH_OUTPUT_IMPL_INPUT);
			
		}
		catch (Exception e)
		{
			logger.log(Level.SEVERE, "Error during initialization: ", e);
		}
	}

}
